package com.sample.service.scheduling;

import org.springframework.scheduling.quartz.JobDetailBean;
import org.springframework.scheduling.quartz.SimpleTriggerBean;

import java.util.Date;

/**
 * User: khanhpham
 * Date: 10/31/11
 */
public class SimpleTriggerFactory {

   public static SimpleTriggerBean createTrigger(JobDetailBean jobDetail, final Date startTime, final Date endTime,
                                                 final String group, final String name) {
      SimpleTriggerBean trigger = new SimpleTriggerBean();
      trigger.setStartTime(startTime);
//      trigger.setEndTime(endTime);
      trigger.setJobDetail(jobDetail);
      trigger.setName(name);
      trigger.setGroup(group);
      trigger.setRepeatInterval(5000);
      trigger.setRepeatCount(10);

      return trigger;
   }
}
